package com.alibaba.csp.sentinel.dashboard.rule.impl;

import java.util.List;

import org.springframework.stereotype.Component;

import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.DegradeRuleEntity;
import com.alibaba.csp.sentinel.dashboard.rule.DynamicRulePublisher;
import com.alibaba.csp.sentinel.dashboard.rule.util.SentinelRuleUtil;

/**
 * 设置熔断规则
 * 
 * @author liu
 * @date 2021-09-08
 */
@Component("degradeRuleRedisPublisher")
public class CustomDegradeRuleRedisPublisher implements DynamicRulePublisher<List<DegradeRuleEntity>> {

    @Override
    public void publish(String app, List<DegradeRuleEntity> rules) throws Exception {
        SentinelRuleUtil.publish(RuleConsts.RULE_DEGRADE, app, rules);
    }

}